package com.yykj.pay.center.client.feign;

import com.yykj.pay.center.client.dto.ClientPayConfigDTO;
import com.yykj.pay.center.client.fallback.PayFallbackFactory;
import com.yykj.pay.center.client.form.PayCreateForm;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.Map;

@FeignClient(name = "pay-center-server", fallbackFactory = PayFallbackFactory.class)
public interface PayFeignClient {

    @PostMapping("/proto/pay/create")
    @ApiOperation(value = "微信小程序下单,返回支微信付信息")
    Map<String, String> create(@RequestBody @Valid PayCreateForm payCreateForm);

    @GetMapping("/proto/pay/config/get")
    @ApiOperation(value = "获取医院支付环境配置")
    ClientPayConfigDTO get(@RequestParam("hospitalId") String hospitalId);

    @GetMapping("/proto/pay/refund")
    @ApiOperation(value = "微信退款")
    boolean refund(@RequestParam("order") String order, @RequestParam("hospitalId") int hospitalId);

    @GetMapping("/proto/pay/tmp/refundForUsercenter")
    @ApiOperation(value = "微信退款 临时给usercenter用")
    boolean refundForUsercenter(@RequestParam("order") String order,@RequestParam("fee") int fee, @RequestParam("hospitalId") int hospitalId);
}
